//
//  CTRefreshVM.swift
//  CodingTest
//
//  Created by LYPC on 2021/11/18.
//

import UIKit
import Alamofire

open class YCRefreshVM: NSObject, CTTableViewRefreshProtocol {
    
    public var hasMore = true
    public var page = 1
    
    public private(set) weak var tableView: CTRefreshTableView?
    
    public var listReq: DataRequest? { willSet { listReq?.cancel() }}
    
    ///  CTRefreshProtocol
    open func reqList(_ isRefresh: Bool, _ callback: @escaping (APIResponseError?) -> Void) {
        
    }
    public var refreshTableView: CTRefreshTableView? {
        set { self.tableView = newValue }
        get { return self.tableView }
    }
    public var refreshPage: Int {
        set { self.page = newValue }
        get { return self.page }
    }
    public var refreshMore: Bool {
        return self.hasMore
    }
    
    deinit {
        k_logViewModelDeinit(self)
    }
}

